#include "LbsObjectThread.h"
#include <QDebug>


MyThread::MyThread(QObject* parent /*= nullptr*/)
    :QThread(parent)
{
    qDebug() << "MyThread....." << QThread::currentThreadId();
}
MyThread::~MyThread()
{
    qDebug() << "~MyThread....." << QThread::currentThreadId();
}
void MyThread::run()
{
}
///////////////////////////////////////////////////////////////////////

LbsObjectThread::LbsObjectThread()
    : QObject(nullptr)
    , m_InnerThread(new MyThread())
    , m_loopLocker(m_InnerThread)
{
    qDebug() << "LbsObjectThread....." << QThread::currentThreadId();
    this->moveToThread(m_InnerThread);

    connect(m_InnerThread, &MyThread::started, this, &LbsObjectThread::run);
    connect(m_InnerThread, &MyThread::finished, this, &LbsObjectThread::finished);
    connect(m_InnerThread, &MyThread::finished, m_InnerThread, &MyThread::deleteLater);


    m_InnerThread->start();
}

LbsObjectThread::~LbsObjectThread()
{
    qDebug() << "~LbsObjectThread....." << QThread::currentThreadId();
}

void LbsObjectThread::run()
{
    qDebug() << "run....." << QThread::currentThreadId();
}

void LbsObjectThread::finished()
{
    qDebug() << "finished....." << QThread::currentThreadId();
    m_InnerThread = nullptr;
}

